package com.qianying.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qianying.entity.ChinaArea;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ChinaAreaMapper extends BaseMapper<ChinaArea> {
    // 继承BaseMapper已包含基本CRUD方法
    // 如需自定义方法可在此添加

    /**
     * 根据层级查询区域
     */
    @Select("SELECT * FROM china_area WHERE level = #{level}")
    List<ChinaArea> selectByLevel(@Param("level")Integer level);

    @Select("SELECT * FROM china_area WHERE parent_id = #{parent_id}")
    List<ChinaArea> selectByParentId(@Param("parent_id")Long parentId);
}